
import { lazy } from "react";
// 引入路由类型
import { RouterItem, RouterList } from "@/router/type";

// 定义二级路由，包含具体的页面路径和元素，以及标题
export const homeRouters: RouterItem[] = [
	{
		path: '/home/index',
		element: lazy(() => import('@/Views/Home/index')),
		title: "首页"
	},
	{
		path: '/home/project',
		element: lazy(() => import('@/Views/Home/project')),
		title: "项目"
	},
]

// 定义一级路由配置，使用history模式
// 包含根路径重定向、home路由、Login路由和默认错误页面
const routerList: RouterList = {
	mode: 'history',
	routes: [
		{
			path: '/',
			// 重定向
			to: '/home/index',
		},
		{
			path: '/home',
			element: lazy(() => import('@/Views/Layout/index')),
			children: homeRouters,// 嵌套子路由
		},
		{
			path: '/login',
			element: lazy(() => import('@/Views/Login/index')),
		},
		{
			path: '*',
			element: lazy(() => import('@/Views/Error/index')),
		}
	]
}
export default routerList// 导出路由配置供其他模块使用
